#include<stdio.h>
void reserve(int *a,int left,int right)
{
    while(left<=right)
    {
        int tmp=a[left];
        a[left]=a[right];
        a[right]=tmp;
        left++;
        right--;
    }
}
int main()
{
    int n,i,a[1000],m;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    scanf("%d",&m);
    reserve(a,n-m,n-1);
    reserve(a,0,n-m-1);
    reserve(a,0,n-1);
    for(i=0;i<n;i++)
        printf("%d ",a[i]);
    return 0;
}